Integrand size = 32, antiderivative size = 557 \[ \int \frac {(e+f x)^2 \cos (c+d x) \cot (c+d x)}{a+b \sin (c+d x)} \, dx=-\frac {(e+f x)^3}{3 b f}-\frac {2 (e+f x)^2 \text {arctanh}\left (e^{i (c+d x)}\right )}{a d}-\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d}+\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d}+\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,e^{i (c+d x)}\right )}{a d^2}-\frac {2 \sqrt {a^2-b^2} f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d^2}+\frac {2 \sqrt {a^2-b^2} f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d^2}-\frac {2 f^2 \operatorname {PolyLog}\left (3,-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \operatorname {PolyLog}\left (3,e^{i (c+d x)}\right )}{a d^3}-\frac {2 i \sqrt {a^2-b^2} f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d^3}+\frac {2 i \sqrt {a^2-b^2} f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d^3} \]
[Out]
Time = 0.80 (sec) , antiderivative size = 557, normalized size of antiderivative = 1.00, number of steps used = 27, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.406, Rules used = {4639, 4493, 3377, 2718, 4268, 2611, 2320, 6724, 4621, 32, 3404, 2296, 2221} \[ \int \frac {(e+f x)^2 \cos (c+d x) \cot (c+d x)}{a+b \sin (c+d x)} \, dx=-\frac {2 i f^2 \sqrt {a^2-b^2} \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d^3}+\frac {2 i f^2 \sqrt {a^2-b^2} \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d^3}-\frac {2 f \sqrt {a^2-b^2} (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d^2}+\frac {2 f \sqrt {a^2-b^2} (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d^2}-\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d}+\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{a b d}-\frac {2 (e+f x)^2 \text {arctanh}\left (e^{i (c+d x)}\right )}{a d}-\frac {2 f^2 \operatorname {PolyLog}\left (3,-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \operatorname {PolyLog}\left (3,e^{i (c+d x)}\right )}{a d^3}+\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,e^{i (c+d x)}\right )}{a d^2}-\frac {(e+f x)^3}{3 b f} \]
[In]
[Out]
Rule 32
Rule 2221
Rule 2296
Rule 2320
Rule 2611
Rule 2718
Rule 3377
Rule 3404
Rule 4268
Rule 4493
Rule 4621
Rule 4639
Rule 6724
Rubi steps \begin{align*} \text {integral}& = \frac {\int (e+f x)^2 \cos (c+d x) \cot (c+d x) \, dx}{a}-\frac {b \int \frac {(e+f x)^2 \cos ^2(c+d x)}{a+b \sin (c+d x)} \, dx}{a} \\ & = \frac {\int (e+f x)^2 \csc (c+d x) \, dx}{a}-\frac {\int (e+f x)^2 \, dx}{b}+\left (\frac {a}{b}-\frac {b}{a}\right ) \int \frac {(e+f x)^2}{a+b \sin (c+d x)} \, dx \\ & = -\frac {(e+f x)^3}{3 b f}-\frac {2 (e+f x)^2 \text {arctanh}\left (e^{i (c+d x)}\right )}{a d}+\left (2 \left (\frac {a}{b}-\frac {b}{a}\right )\right ) \int \frac {e^{i (c+d x)} (e+f x)^2}{i b+2 a e^{i (c+d x)}-i b e^{2 i (c+d x)}} \, dx-\frac {(2 f) \int (e+f x) \log \left (1-e^{i (c+d x)}\right ) \, dx}{a d}+\frac {(2 f) \int (e+f x) \log \left (1+e^{i (c+d x)}\right ) \, dx}{a d} \\ & = -\frac {(e+f x)^3}{3 b f}-\frac {2 (e+f x)^2 \text {arctanh}\left (e^{i (c+d x)}\right )}{a d}+\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,e^{i (c+d x)}\right )}{a d^2}-\frac {\left (2 i \sqrt {a^2-b^2}\right ) \int \frac {e^{i (c+d x)} (e+f x)^2}{2 a-2 \sqrt {a^2-b^2}-2 i b e^{i (c+d x)}} \, dx}{a}+\frac {\left (2 i \sqrt {a^2-b^2}\right ) \int \frac {e^{i (c+d x)} (e+f x)^2}{2 a+2 \sqrt {a^2-b^2}-2 i b e^{i (c+d x)}} \, dx}{a}-\frac {\left (2 i f^2\right ) \int \operatorname {PolyLog}\left (2,-e^{i (c+d x)}\right ) \, dx}{a d^2}+\frac {\left (2 i f^2\right ) \int \operatorname {PolyLog}\left (2,e^{i (c+d x)}\right ) \, dx}{a d^2} \\ & = -\frac {(e+f x)^3}{3 b f}-\frac {2 (e+f x)^2 \text {arctanh}\left (e^{i (c+d x)}\right )}{a d}-\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d}+\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d}+\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,e^{i (c+d x)}\right )}{a d^2}+\frac {\left (2 i \sqrt {a^2-b^2} f\right ) \int (e+f x) \log \left (1-\frac {2 i b e^{i (c+d x)}}{2 a-2 \sqrt {a^2-b^2}}\right ) \, dx}{a b d}-\frac {\left (2 i \sqrt {a^2-b^2} f\right ) \int (e+f x) \log \left (1-\frac {2 i b e^{i (c+d x)}}{2 a+2 \sqrt {a^2-b^2}}\right ) \, dx}{a b d}-\frac {\left (2 f^2\right ) \text {Subst}\left (\int \frac {\operatorname {PolyLog}(2,-x)}{x} \, dx,x,e^{i (c+d x)}\right )}{a d^3}+\frac {\left (2 f^2\right ) \text {Subst}\left (\int \frac {\operatorname {PolyLog}(2,x)}{x} \, dx,x,e^{i (c+d x)}\right )}{a d^3} \\ & = -\frac {(e+f x)^3}{3 b f}-\frac {2 (e+f x)^2 \text {arctanh}\left (e^{i (c+d x)}\right )}{a d}-\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d}+\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d}+\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,e^{i (c+d x)}\right )}{a d^2}-\frac {2 \sqrt {a^2-b^2} f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d^2}+\frac {2 \sqrt {a^2-b^2} f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d^2}-\frac {2 f^2 \operatorname {PolyLog}\left (3,-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \operatorname {PolyLog}\left (3,e^{i (c+d x)}\right )}{a d^3}+\frac {\left (2 \sqrt {a^2-b^2} f^2\right ) \int \operatorname {PolyLog}\left (2,\frac {2 i b e^{i (c+d x)}}{2 a-2 \sqrt {a^2-b^2}}\right ) \, dx}{a b d^2}-\frac {\left (2 \sqrt {a^2-b^2} f^2\right ) \int \operatorname {PolyLog}\left (2,\frac {2 i b e^{i (c+d x)}}{2 a+2 \sqrt {a^2-b^2}}\right ) \, dx}{a b d^2} \\ & = -\frac {(e+f x)^3}{3 b f}-\frac {2 (e+f x)^2 \text {arctanh}\left (e^{i (c+d x)}\right )}{a d}-\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d}+\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d}+\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,e^{i (c+d x)}\right )}{a d^2}-\frac {2 \sqrt {a^2-b^2} f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d^2}+\frac {2 \sqrt {a^2-b^2} f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d^2}-\frac {2 f^2 \operatorname {PolyLog}\left (3,-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \operatorname {PolyLog}\left (3,e^{i (c+d x)}\right )}{a d^3}-\frac {\left (2 i \sqrt {a^2-b^2} f^2\right ) \text {Subst}\left (\int \frac {\operatorname {PolyLog}\left (2,\frac {i b x}{a-\sqrt {a^2-b^2}}\right )}{x} \, dx,x,e^{i (c+d x)}\right )}{a b d^3}+\frac {\left (2 i \sqrt {a^2-b^2} f^2\right ) \text {Subst}\left (\int \frac {\operatorname {PolyLog}\left (2,\frac {i b x}{a+\sqrt {a^2-b^2}}\right )}{x} \, dx,x,e^{i (c+d x)}\right )}{a b d^3} \\ & = -\frac {(e+f x)^3}{3 b f}-\frac {2 (e+f x)^2 \text {arctanh}\left (e^{i (c+d x)}\right )}{a d}-\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d}+\frac {i \sqrt {a^2-b^2} (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d}+\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,-e^{i (c+d x)}\right )}{a d^2}-\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,e^{i (c+d x)}\right )}{a d^2}-\frac {2 \sqrt {a^2-b^2} f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d^2}+\frac {2 \sqrt {a^2-b^2} f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d^2}-\frac {2 f^2 \operatorname {PolyLog}\left (3,-e^{i (c+d x)}\right )}{a d^3}+\frac {2 f^2 \operatorname {PolyLog}\left (3,e^{i (c+d x)}\right )}{a d^3}-\frac {2 i \sqrt {a^2-b^2} f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{a b d^3}+\frac {2 i \sqrt {a^2-b^2} f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{a b d^3} \\ \end{align*}
Time = 1.28 (sec) , antiderivative size = 607, normalized size of antiderivative = 1.09 \[ \int \frac {(e+f x)^2 \cos (c+d x) \cot (c+d x)}{a+b \sin (c+d x)} \, dx=-\frac {x \left (3 e^2+3 e f x+f^2 x^2\right )}{3 b}+\frac {(e+f x)^2 \log \left (1-e^{i (c+d x)}\right )-(e+f x)^2 \log \left (1+e^{i (c+d x)}\right )+\frac {2 i f \left (d (e+f x) \operatorname {PolyLog}\left (2,-e^{i (c+d x)}\right )+i f \operatorname {PolyLog}\left (3,-e^{i (c+d x)}\right )\right )}{d^2}+\frac {2 f \left (-i d (e+f x) \operatorname {PolyLog}\left (2,e^{i (c+d x)}\right )+f \operatorname {PolyLog}\left (3,e^{i (c+d x)}\right )\right )}{d^2}}{a d}+\frac {i \left (a^2-b^2\right ) \left (-2 \sqrt {a^2-b^2} d f (e+f x) \operatorname {PolyLog}\left (2,\frac {b e^{i (c+d x)}}{-i a+\sqrt {-a^2+b^2}}\right )+2 \sqrt {a^2-b^2} d f (e+f x) \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{i a+\sqrt {-a^2+b^2}}\right )-i \left (d^2 \left (2 \sqrt {-a^2+b^2} e^2 \arctan \left (\frac {i a+b e^{i (c+d x)}}{\sqrt {a^2-b^2}}\right )+\sqrt {a^2-b^2} f x (2 e+f x) \left (\log \left (1-\frac {b e^{i (c+d x)}}{-i a+\sqrt {-a^2+b^2}}\right )-\log \left (1+\frac {b e^{i (c+d x)}}{i a+\sqrt {-a^2+b^2}}\right )\right )\right )+2 \sqrt {a^2-b^2} f^2 \operatorname {PolyLog}\left (3,\frac {b e^{i (c+d x)}}{-i a+\sqrt {-a^2+b^2}}\right )-2 \sqrt {a^2-b^2} f^2 \operatorname {PolyLog}\left (3,-\frac {b e^{i (c+d x)}}{i a+\sqrt {-a^2+b^2}}\right )\right )\right )}{a b \sqrt {-\left (a^2-b^2\right )^2} d^3} \]
[In]
[Out]
\[\int \frac {\left (f x +e \right )^{2} \cos \left (d x +c \right ) \cot \left (d x +c \right )}{a +b \sin \left (d x +c \right )}d x\]
[In]
[Out]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 2109 vs. \(2 (481) = 962\).
Time = 0.53 (sec) , antiderivative size = 2109, normalized size of antiderivative = 3.79 \[ \int \frac {(e+f x)^2 \cos (c+d x) \cot (c+d x)}{a+b \sin (c+d x)} \, dx=\text {Too large to display} \]
[In]
[Out]
\[ \int \frac {(e+f x)^2 \cos (c+d x) \cot (c+d x)}{a+b \sin (c+d x)} \, dx=\int \frac {\left (e + f x\right )^{2} \cos {\left (c + d x \right )} \cot {\left (c + d x \right )}}{a + b \sin {\left (c + d x \right )}}\, dx \]
[In]
[Out]
Exception generated. \[ \int \frac {(e+f x)^2 \cos (c+d x) \cot (c+d x)}{a+b \sin (c+d x)} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
Timed out. \[ \int \frac {(e+f x)^2 \cos (c+d x) \cot (c+d x)}{a+b \sin (c+d x)} \, dx=\text {Timed out} \]
[In]
[Out]
Timed out. \[ \int \frac {(e+f x)^2 \cos (c+d x) \cot (c+d x)}{a+b \sin (c+d x)} \, dx=\text {Hanged} \]
[In]
[Out]